<?php
/**
 * Created by PhpStorm.
 * User: 小瓶子
 * Date: 2018/11/6
 * Time: 15:09
 */
namespace app\home\model;
use think\Model;
use think\Db;

class Register extends Model
{
    public $table;
    public function insert($table,$user_tel,$user_nickname,$user_name,$user_email,$user_pwd)
    {//注册
        $this->table = $table;

        $data = [
            'user_tel'=>$user_tel,
            'user_nickname'=>$user_nickname,
            'user_name'=>$user_name,
            'user_email'=>$user_email,
            'user_pwd'=>$user_pwd
        ];
        $red = DB::table($this->table)->insert($data);
        if ($red){
            return $red;
        }
    }

    public function select_all($table,$user_name,$user_n,$user_pwd,$user_p)
    {//登陆
        $this->table = $table;
        return DB::table($this->table)->where([$user_name=>$user_n,$user_pwd=>$user_p])->find();
    }
}